﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cinetoona
{
    public partial class Home : System.Web.UI.Page
    {
        DataAccessDataContext da = new DataAccessDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            getShows(DateTime.Today.Date);

        }

        protected void MovieCalendar_SelectionChanged(object sender, EventArgs e)
        {
            getShows(MovieCalendar.SelectedDate);
        }

        public void getShows(DateTime dt)
        {
            var getShows = from s in da.Shows
                           join m in da.Movies on s.MovieID equals m.MovieID
                           where s.Start.Value.Date == dt
                           select new { m.Title, s.Start, s.Theater, s.Tickets, m.Price, m.Runtime };
            GridView1.DataSource = getShows;
            GridView1.DataBind(); 
        }

        


    }
}